<?php
//加载项目初始文件
include './init.php';
include DIR_CORE.'mysql.php';
/**判断是否登入**/
function i_model() {
	session_start();
	$u = $_SESSION['userInfo']['name'];
	if (isset($_SESSION['userInfo'])) {

		echo "<div style='text-align:right'>欢迎你，<a><font color='blue'>$u</font></a>";
		echo '<a href="./model/logout.php">注销</a></div>';
	} else {
		echo '<div style="text-align:right"><a href="./view/login.html">登入</a>&nbsp;|&nbsp;';
		echo '<a href="./view/regist.html">注册</a>&nbsp;|&nbsp;</div>';
	}
}
//获取用户登入ip
$ip = $_SERVER['REMOTE_ADDR'];
//写入文件(追加)
file_put_contents('visit/record.txt',$ip."\r\n",FILE_APPEND);
//读取总记录数
$info = file('visit/record.txt');
//网站总访问量
$visits = count($info);
//当前用户的访问次数
$ip_visits = 0;
//总访问人数
$uip = array();
foreach($info as $dip){
	//统计独立IP
	if(!in_array($dip,$uip)){
		$uip[] = $dip;
		if($ip == trim($dip))
			$m_visit = count($uip);
	}
	//比较之前去除换行符trim
	if(trim($dip) == $ip)
		$ip_visits++;
}
//总用户
$users = count($uip);

session_start();
$admin = $SESSION['userInfo']['admin_id'];

//加载视图文件
include DIR_VIEW . 'index.html';